package com.blackitheima2.LambdaDemo.test2;
//对象无参无返回值
public class TestApple {
    public static void main(String[] args) {
        //创建实现类
        AppleImple ao=new AppleImple();
        ao.eatA();
        //匿名内部类
        eatApple(new Apple() {
            @Override
            public void eatA() {
                System.out.println("根本停不下来!");
            }
        });
        //Lambda表达式
        eatApple(()-> System.out.println("吃吃吃"));

    }
    public static void eatApple(Apple apple){
        apple.eatA();
    }
}
//接口
interface Apple{
    public abstract void eatA();
}
//实现类
class AppleImple implements Apple {

    @Override
    public void eatA() {
        System.out.println("停不下来!");
    }
}
